package com.hzdesk.media.koreabatchmatvector.bean;

import android.content.Context;

import com.hzdesk.media.koreabatchmatvector.config.AppConfig;
import com.hzdesk.media.koreabatchmatvector.utils.DateUtil;
import com.hzdesk.media.koreabatchmatvector.utils.MacUtil;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

import okhttp3.FormBody;

/**
 * Created by Administrator on 2018/7/5.
 * 上传文件接口上传参数对象
 */

public class UploadBean {
    private String fileUrl;
    //真实名称
    private String realName;
    private String fileSize;
    private String picUrl;
    //显示名称
    private String createTime;
    private String meetingGroup;
    private String meetingName;
    private String meetingTime;

    public UploadBean(VideoFile videoFile, Context context) {
        SimpleDateFormat simpleDateFormat=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
        this.fileUrl = MacUtil.getMacAddress(context)+"/"+ DateUtil.getDay(videoFile.getCreatetime())+"/"+videoFile.getSecondname();
        this.realName = videoFile.getSecondname();
        double size=(double) (videoFile.getSize() / 1048576) + 0.5f;
        this.fileSize = size+"";
        this.picUrl = this.fileUrl+"/"+realName+ AppConfig.FILE_TYPE_JPG;
        this.createTime = simpleDateFormat.format(new Date(videoFile.getCreatetime()));
        this.meetingGroup=videoFile.getMeetingGroup();
        this.meetingName=videoFile.getMeetingName();
        this.meetingTime=simpleDateFormat.format(new Date(videoFile.getMeetingTime()));
    }

    public String getFileUrl() {
        return fileUrl;
    }

    public void setFileUrl(String fileUrl) {
        this.fileUrl = fileUrl;
    }

    public String getRealName() {
        return realName;
    }

    public void setRealName(String realName) {
        this.realName = realName;
    }

    public String getFileSize() {
        return fileSize;
    }

    public void setFileSize(String fileSize) {
        this.fileSize = fileSize;
    }

    public String getPicUrl() {
        return picUrl;
    }

    public void setPicUrl(String picUrl) {
        this.picUrl = picUrl;
    }

    public String getCreateTime() {
        return createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }


    public String getMeetingGroup() {
        return meetingGroup;
    }

    public void setMeetingGroup(String meetingGroup) {
        this.meetingGroup = meetingGroup;
    }

    public String getMeetingName() {
        return meetingName;
    }

    public String getMeetingTime() {
        return meetingTime;
    }

    @Override
    public String toString() {
        return "UploadBean{" +
                "fileUrl='" + fileUrl + '\'' +
                ", realName='" + realName + '\'' +
                ", fileSize=" + fileSize +
                ", picUrl='" + picUrl + '\'' +
                ", createTime=" + createTime +
                ", meetingGroup='" + meetingGroup + '\'' +
                ", meetingName='" + meetingName + '\'' +
                ", meetingTime=" + meetingTime +
                '}';
    }


    public Map<String ,String > getFormBody(){
        Map<String,String> map=new HashMap<>();
        map.put("fileUrl",fileUrl);
        map.put("realName",realName);
        map.put("fileSize",fileSize);
        map.put("picUrl",picUrl);
        map.put("createTime",createTime);
        map.put("meetingGroup",meetingGroup);
        map.put("meetingName",meetingName);
        map.put("meetingTime",meetingTime);
        return map;
    }
}
